\documentclass[12pt, a4paper]{article}

\usepackage{a4}
\usepackage{graphicx}
\usepackage{times}
\usepackage{url}
\usepackage{tikz}
\usepackage{verbatim} 
\usepackage{listings}
\usepackage{float}

\lstset{breaklines}

% If you would like to write in danish uncomment the following two lines.
%\usepackage[latin1]{inputenc}
%\usepackage[danish]{babel}

% Remember to state your full names and student IDs.
\author{Nick H. Lauritsen (20061459)\\
Siyalrach Anton Thomas (20060888)}

% prepend the title with your group name
\title{LIMA P2PN Report 2010}

\begin{document}

\maketitle

\section{System Description} \label{sec:system_description}
During this course a simple unstructured p2p system for finding and sharing
files has been developed. The system is made in java and uses java RMI to communicate between the different peers in a running network. Each peer has its own Java RMI server running in a thread, and an update thread which is scheduled to run every ten seconds. 

%uml
\begin{figure}[H]
\begin{center}
\scalebox{0.8} {
  \input{uml/uml}
}
\end{center}
\caption{UML diagram of the system.}
\label{fig:uml}
\end{figure}

All constants like TTL and the update frequency of the update thread are given in the Config class in the p2p package, therefore this class is more or less connected to all the other classes in the system. The system is build in such a way that all the interesting stuff, regarding the course, takes place inside the p2p package, which is why this package will be described the most in this report.

You might say that the peerpool class is very central in this system, since this is the class which contains knowledge about other peers in the system. The idea is that all other lists in the system are based on the perpool list, from know on plist, within the peerpool class. This means that if a peer disapears from the plist it will also disapear from the neighbor list, from now on nlist, next time the update thread runs. Thereby you might say that the overall idea behind the p2p package design is a layered strategy, since the nlist for example is based on the plist. A possible problem with this design is that each peer has to ping each member of its plist quite frequently to see if it is alive, and since the plist most likely is bigger than the nlist this causes more network traffic. A possitive aspect is however that if a peer no longer is alive then it is simply removed from the plist and next time the update thread runs the peer is removed from the other lists also. 

Moreover the filelist, from now on flist, within the FileList class is based on the files in a folder which each peer is appointed on startup. The FileList class also contains a flist from all the peers neighbors, which is updated every ten seconds if a change has occurred, e.g. a peer adding/deleting a file to its flist, or a peer disappering from the plist and thereby the nlist. 

To search for files within the network the Kwalker class is used, this is however not only based on the FileList class, but also on the NeighborList class, which means this class differs a bit from the layered design.

\begin{comment}
A thorough description of your system---with special focus on the P2P
aspects.  How does your system solve its intended problem; how does it
do what it does at run-time?  If there is a difference between your
design and your implementation, you should be very specific in
describing those differences.

Remember to describe every single design choice and argument for the
validity of those choices. 

When describing your design you should relate your system to other
systems---as e.g., the systems found in the curriculum. Citation is
easy in LaTeX; e.g., ``as seen in Gia~\cite{Chawathe:2003ul}'' or
``the Gnutella specification~\cite{gnutella-spec}''. All papers
included in the curriculum can be found in the BiBTeX file that came
with this report template. 
\end{comment}

\subsection{Bootstrapping the system} \label{sec:bootstrapping-system}
\begin{comment}
Describe how you bootstrap your P2P network. What are the pros and
cons of your design in this regard?
\end{comment}
To solve the bootstrap problem a peer needs to know at least one member of a running network. This system thereby uses the same strategy as the Gnutella protocol, as described in \cite{gnutella-spec}. As in the Gnutella protocol the acquisition of another peers address is not part of this system, and a user has to result to other services in order to get this address. This is off course a problem, since the normal way off acquiring such an address is through a central server, which means a single point of failure. It is however worth noticing that in the gnutella approach the central server could be a lot of different homepages, so there is the possibility of "many single points of failures".

Other ways of solving the bootstrap problem could be using a central tracker like in Bittorrent as described in \cite{Cohen:2003wd} and \cite{izal:2004sp}. This central tracker sends a list of peers to the connecting peer, meaning that this solution also has a single point of failure, with regards to finding the first peer to connect to. 

A completely different approach which could have eliminated the problems of gnutella and bittorent would be to have used a multicast message to find peers on a network.
However a problem with this approach is that it is not possible to use multicast in all environments, like for example the internet. As an example of a system using multicast to solve the bootstrap problem you may look at the following article \cite{multicastBoot}.

\subsection{Finding Neighbours} \label{sec:finding-neighbours}
\begin{comment}
Describe, in great detail and with figures, how you build your overlay
network by using clever neighborhood selection. What are the pros and
cons of your approach?
\end{comment}
As mentioned above the first step in building the overlay network is to gain knowledge of other peers in the network, e.g. adding peers to your plist. In this system this is done by saying hello to other peers, an example of this can be seen in figure \ref{fig:hello}

%figure of hello protocol
\begin{figure}[H]
\begin{center}
\scalebox{0.8} {
  \input{images/hello}
}
\end{center}
\caption{P1 sends out an hello to P2 and P3 which respond by sending back an acknowledgement. P2 and P3 now look at the TTL and sends the hello to all the peers they know if the TTL is greather than 0. If the TTL is not greater than zero the peers will not forward the hello.}
\label{fig:hello}
\end{figure}

The strategy behind a hello call as shown in figure \ref{fig:hello}, is in many ways like the one used by the Gnutella protocol \cite{gnutella-spec}, e.g. ping-pong. This system sends an acknowledgement directly to the peer which issued the hello. This will most likely stress the peer which issued the hello more than if the acknowledgements where send through the same path as the hello message arrived with, e.g. picked up along the way. The direct acknowledgement strategy used in this system does however generate less overall network traffic than the indirect approach since more messages are needed to communicate the acknowledgements back to the issuing peer. 

As mentioned above another strategy for doing this would have been to have a central tracker like in bittorrent as described in \cite{Cohen:2003wd} and \cite{izal:2004sp}.

When a peer knows other peers in the network it is possible to generate an overlay network, by creating neighbors. In this system each peer may at most have 10 neighbors, meaning that it is not possible for all peers to be neighbors with each other in a relatively large network. In this system the overlay network is generated as depicted in figure \ref{fig:helloNeighbor}

%figure of helloNeighbor protocol
\begin{figure}[H]
\begin{center}
\scalebox{0.8} {
  \input{images/helloNeighbor}
}
\end{center}
\caption{P1 asks P3 to be neighbors, since P3 has a capacity of 0, P3 acknowledges, and this results in P1 and P3 being neighbors. P1 still has room for one more neighbor and therefore asks the next highest peer in its plist, e.g. P2, since it was sorted as being before P4, P1 and P2 become neighbors. P1 has no more room for neighbors and therefore does not ask P4. If P4 where to ask P1, it would receive a message telling it that P1 has no more room for neighbors.}
\label{fig:helloNeighbor}
\end{figure}

The systems neighborhood creation algorithm is in some ways like the one in GIA \cite{Chawathe:2003ul}, but still missing key parts like the "pick a neighbor to drop" algorithm. Meaning that the system is inspired by GIA's use of a capacity constraint, but does not implement a neighborhood generation algorithm which utilizes it as well as GIA. As an example in this system the same high capacity nodes risk getting flooded with messages asking to be neighbors, since they are on top of the plist. To prevent this GIA utilizes a of sort flow control. Furthermore where GIA tries to create an even network where all peers are in reach of a high capacity peer, by using a satisfaction variable, this network does not have such a variable, since it has no implementation of the "pick a neighbor to drop" algorithm.

Moreover the design sketched in figure \ref{fig:helloNeighbor} is not a perfect reflection of how the neighborhood generation is done in the implementation, since the design would result in some of the neighbors having more neighbors than their limit allows them to have. To prevent this a new call was made informing the caller whether or not the caller is neighbors with a given peer, if not then the caller removes the peer from the neighbor list. This call is run before the neighborhood generation script every 10 seconds.

Utilizing this overlay network then each peer now knows each of its neighbors files and will be able to answer a search-query on behalf of its neighbor. This will be explained in more detail in section \ref{sec:searching-network}. This section will however continue describing how the neighbors to a peer are informed when a new file is inserted into this peer. This is again handled in the update thread, meaning that every 10 seconds a peer checks whether or not a file has been deleted/added from/to the folder it is assigned. If this is the case the flist is reorganized according to the content of the assigned folder, and forwarded to the peers' neighbors. This procedure is illustrated in figure \ref{fig:filelist}.

%figure of filelist protocol
\begin{figure}[H]
\begin{center}
\scalebox{0.8} {
  \input{images/filelist}
}
\end{center}
\caption{P1's update thread investigates the files in P1's folder and finds a new file. The file is added to P1's flist and afterwards the flist is forwarded to P1's neighbors.}
\label{fig:filelist}
\end{figure}

\subsection{Searching the Network} \label{sec:searching-network}
\begin{comment}
Describe, again in great detail and with illustrations, how searches
are done in your system.
\end{comment}

Searching in the Network is achieved, by implementing a k-walker search, as described in \cite{Lv:2002rt}. When a find command is fired in the terminal window, with the following arguments \textit{find [File name] [TTL] [K]}, where \textit{File name} is the file you are searching for, \textit{TTL} is the number of jumps between each node and \textit{K} is the number of neighbors each peer randomly chooses. This implementation of the k-walker, does first check if the files exist in the neighbors flist, since each peer keeps an updated flist for all its neighbors.

If we can't find the file in our flist, we will send a search request randomly to \textit{K} neighbors if \textit{TTL} hasn't been exceeded, but before that we remove some off our peers in the nlist, these are peers we already know that do not have the file and we might have sent them a search request, that is because peers can be connected in triangle, as depicted in figure \ref{fig:triangle} and we also randomly choose from our nlist, which means we in worst-case can have a cyclic request between two peers.

%figure of peer triangle
\begin{figure}[H]
\begin{center}
\scalebox{0.8} {
  \input{images/triangle}
}
\end{center}
\caption{If P1 sends a search request to its two neighbors P2 and P3, who are connected to each other, we know that P2 and P3 do not have the file, so they shouldn't send a request to each other and thereby minimize network load and maximize the probability for finding the file, the search request from P1, would look like this: \textit{Find:P2PN.xml TTL:2 K:2 FromPeer:P1 KnownPeers:\{P1,P2,P3\}}, KnownPeers-list will continuously grow as the search query is sent among peers in the network.}
\label{fig:triangle}
\end{figure}
 
If the file has been found or TTL is exceeded, we report back to the \textit{FromPeer}. 
A file can be downloaded from a peer by using the command \textit{get [Peer name] [File name]}, when the terminal window receives the \textit{get} command it sends a \textit{fileUpload} command to the peer and receives the file as a \textit{byte[]}, to save the file we use the \textit{fileDownload} method.

\section{Evaluation} \label{sec:evaluation}
A short test and analysis of the system.

\begin{comment}
A short evaluation of your system showing off its strengths and
weaknesses. Here is where you can test your neighbourhood selection
algorithms against each other---if you have chosen to make more than
one. This is also the place where you can test search strategies and
perhaps the effects of one-hop replication.
\end{comment}

\subsection{The overlay network generation} \label{sec:evaluation_overlay}
As mentioned in section \ref{sec:finding-neighbours} the neighbor generation scheme in the network is a very simple version of the GIA system. This subsection will discuss some of the weaknesses of this very simple neighbor generation strategy, by looking at some graph examples given in appendix \ref{sec:graphs}. 

First of all it is very clear from looking at figure \ref{fig:network40} that the neighbor generation algorithm does not have an implementation of the pick a neighbor to drop algorithm as in GIA. This is illustrated by the fact that the network can be easily cut into two pieces by attacking the peer P20. Another, however not as extreme, example of this can be seen in figure \ref{fig:network40_2} where an attack on the peer P35 would remove four other peers from the main network. It is important to keep in mind that these peers could enter the network again provided that a peer from the network has one of them in its plist and is in need of a neighbor, this is however the only way this could happen.

In for example figure \ref{fig:network30} it is also worth noticing that not all peers are in reach of a high capacity peer, since peers do not have the ability to drop neighbors and thereby exhange them with other peers, e.g. super peers. The algorithm however does manage to give all super peers, the peers with capacity 0, a maximal number of neighbors. As mentioned before this however comes at the cost of the super peers always being asked first and thereby being flooded with messages every tenth second from all the peers in need of a neighbor.

\subsection{Searching the network} \label{sec:evaluation_search}
To test searching in our network, we have extended our K-walk implementation, to remember the walk it has made in the network and when a search query is returned back it prints out a trace of the walk. Figure \ref{fig:walkNetwork} shows a network, where we are searching for the file \textit{P2PN.xml} with TTL=3 and K=3 and a print from the terminal window can be found in listing \ref{lst:P2PN}
\begin{figure}[H]
\begin{center}
  \includegraphics[width=15cm]{images/walkNetWork40.png}
\end{center}
\caption{Showing the network traffic when searching for the file \textit{P2PN.xml} with \textit{TTL=3} and \textit{K=3}. Blue arrows are search query being sent through the network, red arrows are when TTL has been exceeded and green arrows indicate we have found the file. The peer P35 is the only one with the file \textit{P2PN.xml} }
\label{fig:walkNetwork}
\end{figure}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN]
Searching:P2PN.xml TTL:3 K:3 Peer:P1
Calling nighborlist
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23
From P4[130.225.16.144:50004]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P4
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P3->P23
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P14->P23
From P32[130.225.16.144:50032]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P14->P32
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P20->P14->P28
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P13->P23
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P13->P25
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P20->P13->P28
\end{lstlisting}

We have made many tests on the same network with different values for TTL and K, and the prints can be found in appendix \ref{sec:using-system}. The result from out test is that if TTL is below 3, then we will never find the file, by setting K to any value, since the shortest path from P1 to P35 is 3 (search stops at P28, because it knows about P35). By setting K to a high value and TTL to 3, we observed that the network was being flooded, since upper bound for connections is bound to $\displaystyle\sum\limits_{n=0}^K TTL^n$ in a k-walk network. However we have constructed our network not to make as many connections, by sending extra information about which peers we have already visited, thereby minimizing the load on the network. Our test shows that by setting K = 3 and TTL to 3, we could sometimes find the file in the network, without having to many connections, that is because we are randomly choosing peers and don't pick peers from \textit{knownPeers} list, so if we make a bad decision we wouldn't be able to find the file.

A feature we haven't implemented is that if \textit{knownPeers} list gets too big, then we wont be able to choose any peers and the search will stop. The idea we had to continue the  search was to have each peer remember which peers they have sent a request too and when they next time get the same request from another peers they would choose peers they haven't sent the request too.

We also discovered that the same peers in the network, sent the same status message back to P1, that is due to every time a peer starts or is passing a search query through the network, it starts K k-walker-threads which don't communicate with the other k-walker-threads and they only inherit their parent \textit{knownPeers} list, therefore some threads end at the same peers. We could stop spamming P1 with the same status message, by every peers remembering the message they have sent back, and if they already have sent the same status message to the same peer within some amount of time, then the message wouldn't be sent. We haven't had the time too implement this caching feature.

\subsection{Nonfunctional characteristics} \label{sec:evaluation_nonfunc}
This section will discuss some of the nonfunctional characteristics of the system as described in \cite{Androutsellis-Theotokis:2004qy}.

\subsubsection{Security}
The system is in many ways not designed with security in mind, as described in section \ref{sec:evaluation_overlay} it is possible to split the network in two by attacking one peer in some cases. Furthermore authenticity and integrity of messages is not in focus in this system, since malicious peers easily could modify messages before forwarding them. Privacy issues are also not looked at in this system, since a peer can search in all files, because the system is made for file sharing purposes and not data storage as for example the system described in \cite{Rowstron:2001th}.
Moreover file availability and persistence is not of high priority, since no file replication is enforced. The only file replication being done in the system is passive as described in \cite{Androutsellis-Theotokis:2004qy}.

\subsubsection{Scalability}
Scalability has been partly in focus in the system, since all tests have been performed locally on one machine, meaning that in order to test the system with more than 10 peers it was required that the system did not steal all ressources on the test machine. However the maximal number of peers which we where able to run on one machine where 45.

The system uses the k-walker searching scheme, as described in section \ref{sec:searching-network}, which is more scalable than the Gnutella flooding approach. The article \cite{Lv:2002rt} mentions three principles of a scalable search method for unstructured p2p networks, of which the first is that \textit{adaptive termination is very important}. This means that the searching scheme should avoid message implosion at the requester, which is not avoided in this systems implementation of the k-walker algorithm, since each peer returns result of a search directly to the requesting peer. The next principle is that \textit{message duplication should be minimized}, meaning that each query should only visit a node once. In this system this is prevented by the query containing a list of all nodes which have received the query, which also has the nice feature that it removes the possibility of cycles. It does however not remove the possibility of sending a query more than once to a peer, because if k is greater than 1 the query will be split and evolve in two different directions. The last principle is that \textit{the granularity of the coverage should be small}, which is also the case since the k-walker algorithm picks k random peers to forward the query to, thereby not flooding the network.

A design characteristic which makes the network less scalable is such a thing as the design decision to every tenth second ask each member of the peers plist if it is alive or not, instead of this being done to the nlist instead, which is a lot smaller.

\subsubsection{Performance}
This report does not contain any statistically correct performance evaluation of the system, since we found it quite hard to for example record the time a search takes in a distributed system. The overall impression is however that the system is okay fast at generating an overlay network and searching in it afterwards.

\subsubsection{Fairness}
The system is not designed for fairness since the nodes with high capacity most likely will get flooded with messages, as described in section \ref{sec:evaluation_overlay}.

\subsubsection{Ressource Management capabilities}
The system is easy to add and delete files to since, the only thing which is needed is to add or remove files from the folder in the file system in which the peer is looking. Moreover it is also easy to search for and download these files afterwards with the find and get commands. The system does however not employ such things as versioning and expiration dates.

\subsubsection{Semantic grouping of information}
No semantic grouping schemes are used in this system.

\section{Conclusion} \label{sec:conclusion}
\begin{comment}
What have you learnt? Is your solution viable? 
\end{comment}
The system is designed with one clear goal in mind, which is to get experience with designing p2p and distributed systems. The system still needs a lot of work before it is viable, because a lot of p2p system issues have not even been dealt with yet. Such important issues as security and fairness have not been dealt with at all and scalability still needs some more work in order to move further away from Gnutella like scalability.

\appendix
\section{Using the System} \label{sec:using-system}
\begin{comment}
This appendix includes complete instructions on installing and using
your system.  Please test your own zip-file on a fresh-horse host
beforehand---if it doesn't work there we wont be able to test it.
\end{comment}

This appendix includes complete instructions on installing and using
the system.

In order to use the system the following should be followed:
\begin{enumerate}
 \item Unpack the zip file and move the content to a desired directory
 \item Open the file start.sh for editing
 \item The variables surrounded by \#TO CHANGE!!!!!!!!! may be edited.
 \begin{enumerate}
  \item project\_home is the absolute path to the folder containing the p2p.jar file
  \item port is the port number of the first peer. The next peers will have port numbers port+i where i is a number in 0,....,max
  \item max is the maximal number of peers to start
  \item maxVisible is the maximal number of visible peers to start, meaning peers starting in their own terminal. The non visible peers will start as a background process
 \end{enumerate}
 \item To run the script point a terminal at the folder containing the script and type sh start.sh
 \item The network will now start up. To close the network again type sh stop.sh
\end{enumerate}

Each peer will on startup randomly be given a folder of files in the folder named "folder".

In each visible peer it is possible, through an interactive terminal, to enter commands. For a command overview "help" may be entered.

Moreover when the get command is used the file is saved in a folder in the temp folder next to the p2p.jar file. The file is placed within a folder with the same name as the peer who called the get command.

\section{Network graphs} \label{sec:graphs}

%network with 30 peers
\begin{figure}[H]
\begin{center}
  \includegraphics[width=15cm]{images/30.png}
\end{center}
\caption{}
\label{fig:network30}
\end{figure}

%network with 40 peers
\begin{figure}[H]
\begin{center}
  \includegraphics[width=15cm]{images/40.png}
\end{center}
\caption{}
\label{fig:network40}
\end{figure}

%network with 40 peers
\begin{figure}[H]
\begin{center}
  \includegraphics[width=15cm]{images/40_2.png}
\end{center}
\caption{}
\label{fig:network40_2}
\end{figure}

\section{Terminal print} \label{sec:using-system}
\begin{lstlisting} [caption=Search trace output, label=lst:P2PN2]
Searching:P2PN.xml TTL:3 K:3 Peer:P1
Calling nighborlist
From P10[130.225.16.144:50010]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P10
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P15->P23
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P13->P25
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P20->P13->P28
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P13->P23
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23
From P2[130.225.16.144:50002]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P2
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN3]
Searching:P2PN.xml TTL:3 K:3 Peer:P1
Calling nighborlist
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P3->P23
From P9[130.225.16.144:50009]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P9
From P5[130.225.16.144:50005]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P5
From P4[130.225.16.144:50004]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P4
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN4]
Searching:P2PN.xml TTL:3 K:3 Peer:P1
Calling nighborlist
From P5[130.225.16.144:50005]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P7->P5
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P7->P6
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P7->P3->P23
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P18->P23
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P20->P18->P28
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P20->P13->P28
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P13->P25
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P13->P23
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P3->P23
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN5]
Searching:P2PN.xml TTL:3 K:3 Peer:P1
Calling nighborlist
From P11[130.225.16.144:50011]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P11
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN6]
Searching:P2PN.xml TTL:3 K:3 Peer:P1
Calling nighborlist
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23
From P4[130.225.16.144:50004]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P4
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P3->P23
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P14->P23
From P32[130.225.16.144:50032]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P14->P32
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P20->P14->P28
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P13->P23
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P13->P25
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P20->P13->P28
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN7]
Searching:P2PN.xml TTL:2 K:3 Peer:P1
Calling nighborlist
From P5[130.225.16.144:50005]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P5
From P3[130.225.16.144:50003]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P3
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P6
From P4[130.225.16.144:50004]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P4
From P3[130.225.16.144:50003]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN8]
Searching:P2PN.xml TTL:2 K:3 Peer:P1
Calling nighborlist
From P3[130.225.16.144:50003]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3
From P11[130.225.16.144:50011]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P11
From P3[130.225.16.144:50003]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P3
From P5[130.225.16.144:50005]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P5
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P6
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN9]
Searching:P2PN.xml TTL:2 K:4 Peer:P1
Calling nighborlist
From P11[130.225.16.144:50011]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P11
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P6
From P5[130.225.16.144:50005]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P5
From P3[130.225.16.144:50003]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P3
From P4[130.225.16.144:50004]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P4
From P3[130.225.16.144:50003]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN10]
Searching:P2PN.xml TTL:2 K:10 Peer:P1
Calling nighborlist
From P2[130.225.16.144:50002]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P2
From P3[130.225.16.144:50003]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3
From P10[130.225.16.144:50010]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P10
From P14[130.225.16.144:50014]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P14
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P24
From P16[130.225.16.144:50016]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P16
From P15[130.225.16.144:50015]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P15
From P13[130.225.16.144:50013]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P13
From P18[130.225.16.144:50018]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P18
From P3[130.225.16.144:50003]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P3
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P7->P6
From P5[130.225.16.144:50005]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P7->P5
From P3[130.225.16.144:50003]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P7->P3
From P11[130.225.16.144:50011]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P11
From P9[130.225.16.144:50009]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P19->P9
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P19->P6
From P3[130.225.16.144:50003]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P19->P3
From P5[130.225.16.144:50005]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P19->P5
From P3[130.225.16.144:50003]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P6
From P3[130.225.16.144:50003]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P3
From P5[130.225.16.144:50005]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P5
From P9[130.225.16.144:50009]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P9
From P4[130.225.16.144:50004]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P4
From P5[130.225.16.144:50005]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P5
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P6
From P3[130.225.16.144:50003]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P3
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN11]
Searching:P2PN.xml TTL:3 K:5 Peer:P1
Calling nighborlist
From P32[130.225.16.144:50032]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P14->P32
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P20->P14->P28
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P14->P23
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P14->P25
From P10[130.225.16.144:50010]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P10
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P13->P25
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P13->P23
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P20->P13->P28
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P15->P23
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P18->P23
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P20->P18->P28
From P11[130.225.16.144:50011]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P11
From P5[130.225.16.144:50005]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P19->P5
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P19->P6
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P19->P3->P23
From P9[130.225.16.144:50009]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P19->P9
From P5[130.225.16.144:50005]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P7->P5
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P7->P6
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P7->P3->P23
From P4[130.225.16.144:50004]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P4
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN12]
Searching:P2PN.xml TTL:5 K:2 Peer:P1
Calling nighborlist
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P6
From P9[130.225.16.144:50009]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P9
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P6
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P8->P3->P23->P18->P28
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P3->P23->P18->P24
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P3->P23->P13->P24
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P8->P3->P23->P13->P25
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN13]
Searching:P2PN.xml TTL:4 K:3 Peer:P1
Calling nighborlist
From P18[130.225.16.144:50018]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P18
From P14[130.225.16.144:50014]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P14
From P13[130.225.16.144:50013]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P13
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P14->P23
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P14->P25
From P33[130.225.16.144:50033]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P14->P32->P33
From P27[130.225.16.144:50027]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P14->P32->P27
From P29[130.225.16.144:50029]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P14->P32->P29
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P24
From P23[130.225.16.144:50023]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P20->P15->P23
From P2[130.225.16.144:50002]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P2
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN14]
Searching:P2PN.xml TTL:5 K:3 Peer:P1
Calling nighborlist
From P9[130.225.16.144:50009]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P9
From P5[130.225.16.144:50005]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P5
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P6
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P16->P24
From P22[130.225.16.144:50022]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P16->P22
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P16->P25
From P32[130.225.16.144:50032]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P14->P32
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P21->P3->P23->P14->P28
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P14->P24
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P21->P3->P23->P18->P28
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P18->P24
From P11[130.225.16.144:50011]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P11
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN15]
Searching:P2PN.xml TTL:5 K:4 Peer:P1
Calling nighborlist
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23->P14->P24
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P17->P3->P23->P14->P28
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23->P14->P25
From P32[130.225.16.144:50032]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23->P14->P32
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23->P15->P24
From P22[130.225.16.144:50022]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23->P16->P22
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23->P16->P24
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P17->P3->P23->P16->P28
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23->P16->P25
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23->P13->P25
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23->P13->P24
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P17->P3->P23->P13->P28
From P11[130.225.16.144:50011]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P11
From P22[130.225.16.144:50022]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P16->P22
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P16->P24
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P21->P3->P23->P16->P28
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P16->P25
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P21->P3->P23->P18->P28
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P18->P24
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P21->P3->P23->P13->P28
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P13->P25
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P13->P24
From P32[130.225.16.144:50032]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P14->P32
From P25[130.225.16.144:50025]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P14->P25
From P28[130.225.16.144:50028]: P35[130.225.16.144:50035] have the file P2PN.xml
        Trace: P1->P21->P3->P23->P14->P28
From P24[130.225.16.144:50024]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P21->P3->P23->P14->P24
From P2[130.225.16.144:50002]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P2
\end{lstlisting}

\begin{lstlisting} [caption=Search trace output, label=lst:P2PN16]
Searching:P2PN.xml TTL:4 K:3 Peer:P1
Calling nighborlist
From P13[130.225.16.144:50013]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23->P13
From P14[130.225.16.144:50014]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23->P14
From P16[130.225.16.144:50016]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P17->P3->P23->P16
From P9[130.225.16.144:50009]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P9
From P16[130.225.16.144:50016]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P3->P23->P16
From P15[130.225.16.144:50015]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P3->P23->P15
From P13[130.225.16.144:50013]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P3->P23->P13
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P12->P6
From P13[130.225.16.144:50013]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P19->P3->P23->P13
From P14[130.225.16.144:50014]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P19->P3->P23->P14
From P15[130.225.16.144:50015]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P19->P3->P23->P15
From P5[130.225.16.144:50005]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P19->P5
From P6[130.225.16.144:50006]: TimeToLive Exceeded, file not found P2PN.xml
        Trace: P1->P19->P6
\end{lstlisting}

\bibliographystyle{plain}
\bibliography{literature}

\end{document}
